package net.osweb.core.fw.jms;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jms.core.JmsTemplate;

/**
 * @author liwu E-mail:
 * @version 创建时间：Jun 17, 2011 2:43:29 PM 类说明
 */
public class JmsSender {
	protected final Log log = LogFactory.getLog(getClass());
	private JmsTemplate jmsTemplate;

	public void setJmsTemplate(JmsTemplate jmsTemplate) {
		this.jmsTemplate = jmsTemplate;
	}

	public JmsTemplate getJmsTemplate() {
		return jmsTemplate;
	}

	public void sendMsg(JmsObject obj) {
		if (log.isDebugEnabled()) {
			log.debug("send msg......");
			log.debug("msg:" + obj);
		}
		this.jmsTemplate.setDeliveryPersistent(true);
		this.jmsTemplate.convertAndSend(obj);
		log.debug("Have Send a msg : " + obj);
	}
}
